package com.timebank.websocket.service;

import com.timebank.common.core.constant.SecurityConstants;
import com.timebank.common.core.constant.ServiceNameConstants;
import com.timebank.common.core.web.pojo.AjaxResult;
import com.timebank.websocket.factory.RemoteWebSocketFallBackFactory;
import com.timebank.websocket.pojo.vo.SendMsgVO;
import io.swagger.annotations.Api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * websocket 服务
 * @author shiliuyinzhen
 */
@FeignClient(contextId = "remoteWebSocketService", value = ServiceNameConstants.WEBSOCKET_SERVICE, fallbackFactory = RemoteWebSocketFallBackFactory.class)
@Api(tags = "websocket服务")
public interface RemoteWebSocketService {

    /**
     * 发送消息
     * @param sendMsgVO
     * @param source
     * @return
     */
    @PostMapping("/send")
    AjaxResult sendMessage(@RequestBody SendMsgVO sendMsgVO, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
